<script>

	export default {
		globalData:{
			config : '',
		},
		
		onLaunch: function(option) {
			const _this = this
			console.log('App Launch')
			const systemInfo = uni.getSystemInfoSync()
			uni.setStorageSync("systemInfo",systemInfo)
			
			if (systemInfo.pixelRatio > 1) {
				//不推荐直接根据反馈的来，为了性能考虑，最好固定2
				this.$options.globalData.pixelRatio = 2;
			}
			
			//获取全局配置
			Promise.all([
				this.$store.dispatch('setConfigAsync'),
				//#ifdef H5
				this.$store.dispatch('keepLogin'),
				//#endif
			]).then(() => {
				this.$isResolve();
				this.util.getUserInfo()

				//#ifdef H5
				let path = option.path
				if(this.$store.state.config.H5 != undefined
					&& this.$store.state.config.H5.only_wechat == 1 
					&& path != 'muu_classroom/pages/material/download'){
					// 判断用户使用的浏览器，如果不是在微信内置浏览器打开，会跳到提示用户使用微信登录页面
					var useragent = navigator.userAgent;
					if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {
						let url = window.location.protocol+"//"+window.location.host + '/addons/muu_classroom/error.html'
						//指定跳转地址
						window.location.href = url;
					}
				}
				//#endif
			})

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		
	}
</script>

<style lang="scss">

// @font-face {
//   font-family: 'iconfont';  /* Project id 1635447 */
//   src: url('//at.alicdn.com/t/font_1635447_8bghkydpm2.woff2?t=1652410235802') format('woff2'),
//        url('//at.alicdn.com/t/font_1635447_8bghkydpm2.woff?t=1652410235802') format('woff'),
//        url('//at.alicdn.com/t/font_1635447_8bghkydpm2.ttf?t=1652410235802') format('truetype');
// }
@font-face {
  font-family: 'iconfont';  /* Project id 1635447 */
  src: url('static/css/iconfont/iconfont.woff2') format('woff2'),
       url('static/css/iconfont/iconfont.woff?t=1652410235802') format('woff'),
       url('static/css/iconfont/iconfont.ttf?t=1652410235802') format('truetype');
}
.iconfont{
	font-family:"iconfont" !important;
	font-size:16px;font-style:normal;
	-webkit-font-smoothing: antialiased;
	-webkit-text-stroke-width: 0.2px;
	-moz-osx-font-smoothing: grayscale;
}
/*每个页面公共css */
.main-section {
	-webkit-box-flex: 1;
	-webkit-flex: 1;
	flex: 1;
	height: 100%;
	height: calc(100% -(constant(safe-area-inset-bottom)));
	height: calc(100% - (env(safe-area-inset-bottom)));
	overflow-y: auto;
}
.main-section.top {
	padding-top: 0;
}
// #ifdef H5
.main-section.top {
	padding-top: 70rpx;
}
uni-slider .uni-slider-thumb {
	left: 0;
}
// #endif
.main-section.tabbar-bottom {
	padding-bottom: 102rpx;
	padding-bottom: calc(102rpx + constant(safe-area-inset-bottom));
	padding-bottom: calc(102rpx + env(safe-area-inset-bottom));
	height: calc(100% - (102rpx + constant(safe-area-inset-bottom)));
	height: calc(100% - (102rpx + env(safe-area-inset-bottom)));
}
.main-section.video-player {
	padding-top: 422rpx;
}
.hide-bottom {
	padding-bottom: 0;
	padding-bottom: calc(0 + constant(safe-area-inset-bottom));
	padding-bottom: calc(0 + env(safe-area-inset-bottom));
}
.text-ellipsis {
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 1;//文字上限行
	-webkit-box-orient: vertical;
}
.text-ellipsis-2 {
	display: -webkit-box;
	overflow: hidden;

	white-space: normal !important;
	text-overflow: ellipsis;
	word-wrap: break-word;

	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.hidden {
	display: none;
}
.show {
	display: block;
}
[v-cloak]{
	display: none;
}
image {
	will-change: transform
}

rich-text {
	line-height: 44rpx;
	font-size: 28rpx;
}

/*课程标签*/
.base-info {
	.tabs {
		.item {
			display: inline-block;
			padding: 0 10rpx;
			text-align: center;
			font-size: 24rpx;
			line-height: 38rpx;
			border-radius: 16rpx;
			color: #fff;
			margin-right: 10rpx;
		}
		.only-member {
			background-color: #dd524d;
		}
		.score {
			background-color: #ff9900;
		}
	}
}
/*内容页提示*/
.tip {
	color: #999;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 768rpx;
}

/* #ifdef H5 */
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
	/* 隐藏滚动条，但依旧具备可以滚动的功能 */
	display: none;
	width: 0 !important;
	height: 0 !important;
	-webkit-appearance: none;
	background: transparent;
	color: transparent;
}
/* #endif */
	
</style>
